home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 25 / AACD 25.iso / AACD / Magazine / Online / QMail / source / auto-int8.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-04-15  |  660 b   |  41 lines

  1. #include "substdio.h"
  2. #include "readwrite.h"
  3. #include "exit.h"
  4. #include "scan.h"
  5. #include "fmt.h"
  6.  
  7. char buf1[256];
  8. substdio ss1 = SUBSTDIO_FDBUF(write,1,buf1,sizeof(buf1));
  9.  
  10. void puts(s)
  11. char *s;
  12. {
  13.   if (substdio_puts(&ss1,s) == -1) _exit(111);
  14. }
  15.  
  16. void main(argc,argv)
  17. int argc;
  18. char **argv;
  19. {
  20.   char *name;
  21.   char *value;
  22.   unsigned long num;
  23.   char strnum[FMT_ULONG];
  24.  
  25.   name = argv[1];
  26.   if (!name) _exit(100);
  27.   value = argv[2];
  28.   if (!value) _exit(100);
  29.  
  30.   scan_8long(value,&num);
  31.   strnum[fmt_ulong(strnum,num)] = 0;
  32.  
  33.   puts("int ");
  34.   puts(name);
  35.   puts(" = ");
  36.   puts(strnum);
  37.   puts(";\n");
  38.   if (substdio_flush(&ss1) == -1) _exit(111);
  39.   _exit(0);
  40. }
  41.